#include <iostream>
#include <fstream>
#include <boost/thread.hpp>
#include "logging.hpp"

Logging _logger;
boost::mutex _logger_mutex;

Logging::Logging() {}
Logging::~Logging() {
	if( file.is_open() ) file.close();
}
void Logging::Open( const char *filename, LoggingLevels _lvl ) {
	lvl = _lvl;
	file.open(filename, std::ios_base::app);
}
void Logging::Write( std::stringstream &s ) {
	boost::lock_guard<boost::mutex> lock(_logger_mutex);
	file << s.str() << std::endl;
	file.flush();
}
